﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YasharEl.Infrastructure
{
    public static class ExceptionExtensions
    {
        public static string FullMessage(this Exception exception)
        {
            StringBuilder message = new StringBuilder(exception.ToString());
            while (exception.InnerException != null)
            {
                exception = exception.InnerException;

                message.Append(Environment.NewLine);
                message.Append("-----------Inner Exception----------");
                message.Append(Environment.NewLine);
                message.Append(exception.ToString());
            }
            return message.ToString();
        }
    }
}
